package com.coocaa.ops.admin.v1.auth.sys.biz.impl;


import com.coocaa.ops.admin.v1.auth.sys.biz.ISysMenuRunBiz;
import com.coocaa.ops.admin.v1.auth.sys.mapper.ISysMenuRunMapper;
import com.coocaa.ops.common.core.base.BaseBizImpl;
import com.coocaa.ops.common.core.biz.auth.entity.SysMenuRunEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author bijiahao
 * @date : 2019/3/14.
 * @description
 */
@Service
public class SysMenuRunBizImpl extends BaseBizImpl<ISysMenuRunMapper, SysMenuRunEntity> implements ISysMenuRunBiz {


    @Override
    public void saveBatch(Integer menuId, List<SysMenuRunEntity> entitys) {
        getMapper().deleteByMenuId(menuId);
        if (CollectionUtils.isNotEmpty(entitys)) {
            getMapper().addBatch(entitys);
        }
    }


    /**
     * 查询所有数据
     * @param params
     * @return
     */
    @Override
    public List<SysMenuRunEntity> queryAll(Map<String, Object> params) {
         if (null == params){
             params = new HashMap<>(0);
         }
         return getMapper().queryAll(params);
    }
}
